from PyQt4.QtCore import Qt
from PyQt4.QtGui import QWidget, QLabel, QPixmap, QFont
from ..widgets.mixed_button import MixedButton


class MsgBox(QWidget):

	def __init__(self, *args, **kw):
		QWidget.__init__(self, *args, **kw)
		self.setGeometry((1024-800)/2, (769-530)/2, 800, 530)
#
#		background graphic
#
		bg = QLabel(self)
		s = "resources/popup_bg.png"
		bg.setPixmap(QPixmap(s))
		bg.setGeometry(0, 0, 800,530)
#
#		font
#
		font = QFont("Gabrielle", 28)
#
#		title label
#
		self.title = QLabel(self)
		self.title.setGeometry(50,20,429,50)
		self.title.setText("Ahem!")
		self.title.setFont(font)
		self.title.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter )

		ss = """
			QLabel {
				color		: yellow;
			}
		"""
		self.title.setStyleSheet(ss)

		self.message = QLabel(self)
		self.message.setGeometry(92,120,618,300)
		self.message.setAlignment(Qt.AlignVCenter | Qt.AlignHCenter )
		self.message.setText("This a default message intended\nto test the widget.\n\nWe would like to extend our apologies\nto anyone who was expecting a real message")
		self.message.setFont(font)
		self.message.setStyleSheet(ss)

		self.dismiss = MixedButton("I See.", self)
		self.dismiss.setGeometry(520, 462, 210, 50)

		self.hide()

	def setTitle(self, s):
		self.title.setText(s)

	def setMessage(self, s):
		self.message.setText(s)

	def setButton(self, s):
		self.dismiss.setText(s)

	def setHandler(self, func):
		self.dismiss.clicked.connect(func)



